package
{
	import flare.display.TextSprite;
	import flare.vis.data.NodeSprite;
	
	import flash.events.MouseEvent;
	import flash.text.StyleSheet;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	import mx.controls.Alert;
	import mx.controls.Label;

	public class GnivzNodeSprite extends NodeSprite
	{
		//in Alpha + RGB format
		private var LIGHT_ORANGE:uint = 0xFFFF9933;
		private var ORANGE:uint = 0x66FF6600;
		private var DARK_ORANGE:uint = 0xFFC45205;
		
		
		//the name of the entity represented by this node
		protected var nodeName:String;
		
		//the link to this entity in gnizr (bookmark, user, or tag)
		protected var url:String;
		
		//the text to be displayed when this node is hovered over
		protected var hoverText:String;
		
		public var ts:TextSprite;
		public var label:Label;
		
		public function GnivzNodeSprite(nodeName:String, url:String, hoverText:String)
		{
			super();
			
			this.nodeName = nodeName;
			this.url = url;
			this.hoverText = hoverText;
			
			this.fillColor = ORANGE;
			this.lineColor = DARK_ORANGE;
			

			ts = new TextSprite();
			ts.textField.width = 140;
			ts.text = nodeName;  
			
			this.addChild(ts);
			
			
			this.buttonMode = true;
		}
		
		public function getNodeName():String
		{
			return nodeName;
		}
		
		public function getHoverText():String
		{
			return hoverText;
		}
		
		public function getURL():String
		{	
			return url;
		}
		
		
		private function _getCustomizedTextSprite(css:StyleSheet):TextSprite 
		{
			
			  var ts:TextSprite = new TextSprite();
			
			  ts.textField.width = 140;
			  
			  ts.textField.styleSheet = css;  
			  
			  ts.textField.autoSize = TextFieldAutoSize.CENTER;  
              ts.textField.multiline = true;  
			  
//			  ts.textField.background = true;
//			  ts.textField.backgroundColor = 0xffffaa;
		
              ts.textField.wordWrap = true;

			  ts.horizontalAnchor = TextSprite.CENTER;
			  ts.verticalAnchor = TextSprite.CENTER;
			 
			  return ts;
			
		}
	}
}